package com.zyp.jobseeker.enums;

/**
 * 申请状态枚举
 */
public enum ApplicationStatus {
    PENDING(0, "待处理"),
    REJECTED(1, "已拒绝"),
    INTERVIEW_INVITED(2, "已邀请面试");

    private final int code;
    private final String desc;

    ApplicationStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据code获取对应的枚举值
     */
    public static ApplicationStatus getByCode(int code) {
        for (ApplicationStatus status : ApplicationStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的申请状态代码: " + code);
    }
}
